{% extends "base.html" %}
{% load tradesys_extras %}


{% block menu %}
    <a href="/tradesys/MyTradePlan">我的计划</a> &rarr;
    <b>交易计划报告</b>
{% endblock %}

{% block content %}
<h1>交易结论</h1>

{% if tp_obj.plan_result == 'N' %}
	<h2>不做交易</h2>
{% endif %}

{% if tp_obj.plan_result == 'B' %}
	<h2>做多美元，做空非美</h2>
{% endif %}

{% if tp_obj.plan_result == 'S' %}
	<h2>做空美元，做多非美</h2>
{% endif %}



<li> 日期: {{tp_obj.begin_time}} </li>


<table class="graph diffview">
  <tr><td colspan=7><h2>市场整体情况</h2></td></tr>
  <tr>
    <th>图表 </th>
    {% for form in movd_formset reversed %}
    <td class="thumb">
      <a href="{{image_base_url}}Archive/{{tp_obj.id}}/USDX_{{timeframe_dict|hash:form.timeframe.value}}.gif" alt="diff_view">
	<img src="{{image_base_url}}Archive/{{tp_obj.id}}/USDX_{{timeframe_dict|hash:form.timeframe.value}}.gif" alt = "usdx"/>
      </a>
    </td>
    {% endfor %}
  </tr>

  <tr>
    <th>级别</th>
    {% for form in movd_formset reversed %}
    <td>{{form.id}} {{form.timeframe.as_hidden}} {{ timeframe_dict|hash:form.timeframe.value }}</td>
    {% endfor %}
  </tr>

  <tr>
    <th>客观</th>
    {% for form in movd_formset reversed %}
    <td>{{ obj_dir|hash:form.obj_dir.value }}</td>
    {% endfor %}
  </tr>

  <tr>
    <th>主观</th>
    {% for form in movd_formset reversed %}
    <td>{{ sub_dir|hash:form.sub_dir.value }}</td>
    {% endfor %}
  </tr>


</table>


<table class="graph diffview">
  <tr><td colspan=7><h2>長期</h2></td></tr>
  <tr>
    <th>图表 </th>
    {% for item in b_diffview_set reversed %}
    <td class="thumb">
      <a href="{{image_base_url}}Archive/{{tp_obj.id}}/{{item.symbol_name}}_{{timeframe_dict|hash:item.timeframe}}.gif" alt="diff_view">
	<img src="{{image_base_url}}Archive/{{tp_obj.id}}/{{item.symbol_name}}_{{timeframe_dict|hash:item.timeframe}}.gif" alt = "diff_view"/>
      </a>
    </td>
    {% endfor %}
  </tr>

  <tr>
    <th>客观</th>
    {% for item in b_diffview_set reversed %}
    <td> {{ obj_dir|hash:item.obj_dir }}</td>
    {% endfor %}
  </tr>

  <tr>
    <th>主观</th>
    {% for item in b_diffview_set reversed %}
    <td>{{ sub_dir|hash:item.sub_dir }} </td>
    {% endfor %}
  </tr>



  <tr><td colspan=7><h2>短期</h2></td></tr>
  
  <tr>
    <th>圖表</th>
    {% for item in s_diffview_set reversed %}
    <td class="thumb">
      <a href="{{image_base_url}}Archive/{{tp_obj.id}}/{{item.symbol_name}}_{{timeframe_dict|hash:item.timeframe}}.gif" alt="diff_view">
        <img src="{{image_base_url}}Archive/{{tp_obj.id}}/{{item.symbol_name}}_{{timeframe_dict|hash:item.timeframe}}.gif" alt = "diff_view"/>
      </a>
    </td>
    {% endfor %}
  </tr>

  <tr>
    <th>客观</th>
    {% for item in s_diffview_set reversed %}
    <td> {{ obj_dir|hash:item.obj_dir }} </td>
    {% endfor %}
  </tr>

  <tr>
    <th>主观</th>
    {% for item in s_diffview_set reversed %}
    <td> {{ sub_dir|hash:item.sub_dir }}</td>
    {% endfor %}
  </tr>

  <tr>
    <th>强弱</th>
    {% for item in s_diffview_set reversed %}
    <td> {{ item.strength }}</td>
    {% endfor %}
  </tr>

  <tr>
    <th>规范</th>
    {% for item in s_diffview_set reversed %}
    <td> {{ normative|hash:item.normative }}</td>
    {% endfor %}
  </tr>


  <tr>
    <th>过滤</th>
    {% for form in first_select_view reversed %}
    <td> {{ exreason|hash:form.exclude_reason.value }}</td>
    {% endfor %}
  </tr>
</table>
<br>
<br>
<table>
<tr><th>市场综合結論:</th><td colspan=6>{{ mov_form.market_result.value }}</td></tr>
<tr><th>周内市场分化結論:</th><td colspan=6>{{ mov_b_res }}</td></tr>
<tr><th>日内市场分化結論:</th><td colspan=6>{{ mov_s_res }}</td></tr>
</table>

{% if selected == 0 %}
	<h2>没有入选货币</h2>
{% endif %}

{% if selected == 1 %}
<table class="graph diffview">
  <tr>
    {% for item in selected_view %}
    {% if forloop.counter0|divisibleby:5 %}
    {% if forloop.counter0 != 0 %} <tr> {% endif %}	</tr><tr>
    {% endif %}
    {% if forloop.counter0|divisibleby:5 %}<th>{{ item.symbol_name.value }} 图表 </th>{% endif %}
    <td class="thumb">
      <a href="{{image_base_url}}Archive/{{tp_obj.id}}/{{item.symbol_name.value}}_{{timeframe_dict|hash:item.timeframe.value}}.gif" alt="diff_view">
	<img src="{{image_base_url}}Archive/{{tp_obj.id}}/{{item.symbol_name.value}}_{{timeframe_dict|hash:item.timeframe.value}}.gif" alt = "diff_view"/>
      </a>
      {{ obj_dir|hash:item.obj_dir.value }}<br>{{ sub_dir|hash:item.sub_dir.value }}
    </td>
    {% endfor %}
  </tr>
</table>
{% endif %}

{% endblock %}
